import asyncio
import time
#异步协程
async def getContent(url):
    print("请求")
    await asyncio.sleep(2)
    print("请求结束")

async def func1():
    print("凑数方法1")
    await asyncio.sleep(5)
    print("凑数方法1.1")

async def func2():
    print("凑数方法2")
    await asyncio.sleep(2)
    print("凑数方法2.1")

async def main():
    urls=[
        "www.baidu.com",
        "www.bilibili.com",
        "www.163.com"
    ]
    tasks = []
    test = [
        asyncio.create_task(func1()),
        asyncio.create_task(func2())
    ]

    #常规爬虫使用
    # for url in urls:
    #     d = asynicio.create_task(getContent(url))
    #     tasks.append(d)
    # await asyncio.wait(tasks)

    await asyncio.wait(test)

if __name__ == '__main__':
    asyncio.run(main())